package com.ddadmin.common.config.proprety;

import com.ddadmin.common.constant.SystemConstant;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties("dd.upload")
public class UploadProperty {

    /**
     * 当前系统环境
     */
    private String os;

    /**
     * windows 系统文件上传路径
     */
    private String windowsPath;

    /**
     * linux 系统文件上传路径
     */
    private String linuxPath;

    /**
     * upload path 根据系统环境获取上传路径
     */
    public String getUploadPath() {
        return this.os.equals(SystemConstant.WINDOWS) ? this.windowsPath : this.linuxPath;
    }

}
